import { defineStore } from "pinia";
import { ref } from "vue";

//第一个参数是唯一storeId,setupStore风格
const useNewsStore = defineStore("news", () => {
  //ref包装定义的就是 state
  const newslist = ref([]);

  const addNews = (news) => {
    newslist.value.push({ ...news });
  };

  return {
    newslist,
    addNews,
  };
});

export default useNewsStore;
